<template>
  <div>
    
    <router-view @colless="colless" @add="add" :ListData="ListData" :shopData="shopData" @del="del"></router-view>
  </div>
</template>

<script>
  export default {

      data() {
        return {
          ListData:[],
          shopData:[],
        };
      },
      methods:{

        //收藏
        colless(val){
          let arry = this.ListData.findIndex((item)=>item.id == val.id)
          console.log(arry);
          if(arry == -1){
            this.ListData.push(val)
          }else{
            return this.ListData
          }
            
        },
        



        add(val){
          console.log(val);
          this.shopData.push(val)
        },
        del(index){
          console.log(index);
          this.ListData.splice(index,1)
        }

       
      },
      components:{
        
      },
      created(){

      }
  }
</script>

<style lang="scss">

</style>